<?php
class Admin_inventory_list_Controller extends Template_Controller {

	public $template = 'admin_popup/index';
	
    public function __construct()
    {
        parent::__construct();
    }
    
	public function __call($method, $arguments)
	{
		// Disable auto-rendering
		$this->auto_render = FALSE;
	}
	
    private function _format_showlist($mlist)
    {
		for($i=0; $i<count($mlist); $i++)
		{
			$mlist[$i]['inventory_date'] = $this->format_int_date($mlist[$i]['inventory_date'],$this->site['site_short_date']);
		}
		return $mlist;
	}
	
    public function index()
	{
		$this->template->content = new View('admin_inventory/list_inventory');
		
		$model = new Inventory_Model();
		$mlist = $model->get_by_group();
		$mlist = $this->_format_showlist($mlist);
		$this->template->content->mlist = $mlist;
	}
	
	public function product($id = '')
	{
		$this->template->content = new View('admin_inventory/list_product');
		
		if(!$id)
			$id = $this->input->post('hd_id');
			
		$model = new Inventory_Model();
		$mlist = $model->get_by_product($id);
		$mlist = $this->_format_showlist($mlist);
		$this->template->content->mlist = $mlist;
	}
}
?>